﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hxj.Common;
using Hxj.Web;
using RicciWebsite.Model;

namespace RicciWebsite.news
{
    public partial class newsdetail : RicciWebsite.Pages.PageBase
    {

        /// <summary>
        /// 新闻ID
        /// </summary>
        protected Guid? nid;

        protected void Page_Load(object sender, EventArgs e)
        {
            string tempnid = Request.QueryString["nid"];
            if (Validator.IsGuid(tempnid))
            {
                nid = new Guid(tempnid);
            }

            if (nid.HasValue)
            {
                data_news newsModel = RicciDatabase.Default.From<data_news>().Where(data_news._.nid == nid.Value.ToString()).ToFirst();

                if (null != newsModel)
                {

                    //if (newsModel.status != Common.NewsStatus.未发布.GetHashCode())
                    //{
                    txtcomefrom.Text = newsModel.comefrom;
                    txtcontent.Text = newsModel.ncontent;
                    txtsubtime.Text = newsModel.subtime.ToString("yyyy-MM-dd");
                    txttitle.Text = newsModel.ntitle;


                    //TODO添加查看记录数



                    return;
                    //}
                }

            }

            Response.Redirect("~/news.aspx");

        }
    }
}
